using System;
using System.IO;

namespace DynamicConfigurationManager.ConfigMapAttributes
{
    /// <summary>
    /// CurrentDirectory compares the attribute value to the fully qualified path of the current directory.
    /// </summary>
    internal class CurrentDirectory : IConfigMapAttribute
    {
        public bool Execute( string configMapAttribute )
        {
            LogHelper.Append( "CurrentDirectory: matching to {0}", Environment.CurrentDirectory );
            var fullPath = Path.GetFullPath( configMapAttribute.TrimEnd( '\\' ) );
            return fullPath.Equals( Environment.CurrentDirectory, StringComparison.InvariantCultureIgnoreCase );
        }
    }
}